package com.qin.controller;

import com.alibaba.fastjson.JSONObject;
import com.qin.entity.TSystem;
import com.qin.service.SysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller("sysController")
@RequestMapping("/sys")
@ResponseBody
public class SysController {

    @Autowired
    SysService sysService;

    @RequestMapping(value="/querySystems", produces="application/json;charset=UTF-8")
    public String querySystems(@RequestBody String body){
//        System.out.println("web层：querySystems");
        System.out.println("接口调用：/sys/querySystems");

        //入参封装到实体类
        TSystem tSystem = JSONObject.parseObject(body, TSystem.class);
        System.out.println("接口入参：" + body);
        //调用service层
        String retString = sysService.querySystems(tSystem).toString();

        System.out.println("接口出参：" + retString);
        return retString;
    }
}
